package com.knightcloud.micro.upms.controller;

import com.knightcloud.common.base.vo.response.R;
import com.knightcloud.micro.upms.api.entity.SysUser;
import com.knightcloud.micro.upms.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.function.Function;

@RestController
@RequestMapping("/sys/user")
@RequiredArgsConstructor
public class SysUserController {

	/**
	 * 系统用户服务
	 */
	private final ISysUserService sysUserService;

	@PreAuthorize(value = "hasAuthority('system:user:*')")
	@GetMapping("/list")
	public R<List<SysUser>> list() {
		return R.list(sysUserService.list(), Function.identity());
	}

}
